// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indicatorDots:true,
    autoplay:true,
    interval:5000,
    imgUrlList:[
        "/pages/images/haibao/fengshan.jpg",
        "/pages/images/haibao/kongtiao.jpg",
        "/pages/images/haibao/xiarikuanghuangou.jpg"
    ],
    menuList:[
        {
            "item":"08:00",
            "text":"已结束"
        },
        {
            "item":"11:00",
            "text":"抢购中"
        },
        {
            "item":"16:00",
            "text":"即将开始"
        },
        {
            "item":"18:00",
            "text":"待开始"
        }
    ],
    navList:[
        {"img":"/pages/images/icon/lyhq.png","name":"领取优惠券"},
        {"img":"/pages/images/icon/smgw.png","name":"扫码购物"},
        {"img":"/pages/images/icon/wlcx.png","name":"物流查询"},
        {"img":"/pages/images/icon/pt.png","name":"拼好货"}
    ],
    goodsList:[
      {
      "id":"001",
      "img":"/pages/images/haibao/kongqijinghuaqi-1.jpg",
      "name":"双变皮 电冰箱",
      "nowPrice":"1999.00",
      "oldPrice":"2200.00",
      "goodValuation":"99.7",
      "comment":"1000"
    },
    {
      "id":"002",
      "img":"/pages/images/haibao/kongqijinghuaqi-2.jpg",
      "name":"双变皮 电冰箱",
      "nowPrice":"1999.00",
      "oldPrice":"2200.00",
      "goodValuation":"99.7",
      "comment":"1000"
    }
  ],
  time: "11:00"
  },
   getDateTime:function(){
    const myDate = new Date();
    const tiemData =  myDate.getHours() + ":"+ myDate.getMinutes(); 
    return tiemData;
  },
  parseTime:function(time) {
    const [hours, minutes] = timeStr.split(':').map(Number);
    const date = new Date();
    date.setHours(hours, minutes, 0, 0);
    console.log(time)
    return date;
  },
  getMx:function(item){
    const tiem = item._relatedInfo.anchorTargetText;
    let tiemData = this.data.time
    if(tiem.substring(0,2)==tiemData.substring(0,2)){
      console.log("抢购中")
      wx.navigateTo({
        url: '../buying/buying',
      })
    }else{
      console.log("当前时间："+tiemData+",抢购时间："+tiem)
      wx:wx.showModal({
        content: '没有到/已经过抢购时间'+tiem,
        title: '提示',
        success: (result) => {},
        fail: (res) => {
          console.log("弹窗提示异常！")
        },
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    // wx.showLoading({
    //   title: '正在加载',
    // })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    console.log("用户触底")
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})